<!--  -->
<template>
  <div class="floor">
    <div @click="toCate" v-for="(v, i) in floors" :key="i" class="wrap">
      <div class="title">
        <img :src="v.floor_title.image_src" alt="" />
      </div>
      <div class="wrapper">
        <div
          v-for="(item, index) in v.product_list.slice(0, 1)"
          :key="index"
          class="left"
        >
          <img :src="item.image_src" alt="" />
        </div>
        <div class="right">
          <div
            v-for="(item1, index1) in v.product_list.slice(1, 5)"
            :key="index1 + 1"
            class="img"
          >
            <img :src="item1.image_src" alt="" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getFloor } from "@/util/home.js";

export default {
  name: "HomeFloor",
  data() {
    return {
      floors: [],
    };
  },
  created() {
    this.getFloor();
  },
  methods: {
    async getFloor() {
      let { data } = await getFloor();
    //   console.log(data);
      this.floors = data.message;
    },
    toCate(){
      this.$router.push('/goodslist/1015')
    }
  },
};
</script>

<style scoped lang='less'>
.floor {
    padding: 5px 0;
    margin-bottom: 50px;
  .wrap {
    .title {
      padding: 5px 0;
      img {
        width: 100%;
      }
    }
    .wrapper {
      display: flex;
      .left {
        flex: 1;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .right {
        flex: 2;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        .img {
          //   background: #000;
          width: 47%;
          border-left: 6px solid #fff;
        }
        .img:nth-child(1),.img:nth-child(2){
            border-bottom: 6px solid #fff;
        }
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>